package
{
    import flash.display.MovieClip;

    [Embed(source="/../res/assets.swf", symbol="BellMC")]
    public class Bell extends MovieClip
    {
        private static const SCALE : Number = 0.4;
        
        private static var _WIDTH  : Number;
        private static var _HEIGHT : Number;
        public static function get WIDTH()  : Number { return _WIDTH;  }
        public static function get HEIGHT() : Number { return _HEIGHT; }
        
        public function Bell()
        {
            super();
            scaleX = scaleY = SCALE;
            gotoAndPlay(Math.round(Math.random() * totalFrames));
        }
        
        public static function Init() : void
        {
            var bell : Bell = new Bell();
            _WIDTH  = bell.width;
            _HEIGHT = bell.height;
            bell = null;
        }
        
        public function boom(score_add : Number) : void
        {
            var boom : BellBoom = new BellBoom(die);
            boom.scaleX = boom.scaleY = SCALE;
            boom.x = x;
            boom.y = y;            
            parent.addChild(boom);
            
            var flyingScore : FlyingScore = new FlyingScore();
            flyingScore.x = x;
            flyingScore.y = y;
            flyingScore.setScore(score_add);
            parent.addChild(flyingScore);
            flyingScore.fly();

            parent.removeChild(this);
        }
        
        public function die() : void
        {
            // remove from parent
            //parent.removeChild(this);
        }
    }
}